﻿using Sample.Application;
using Rhino.Mocks;
using NUnit.Framework;

namespace Tests.Sample.Application
{
    public partial class SamplePresenterTests
    {
        [TestFixture]
        public class WhenInitializing
        {
            private IStuffRepository _repository;
            private Stuff _stuff;
            private int _id = 5;
            private SamplePresenter _presenter;

            [SetUp]
            public void SetUp()
            {
                _stuff = new Stuff(){ID = 5};
                _repository = MockRepository.GenerateMock<IStuffRepository>();

                _presenter = new SamplePresenter(_repository);
            }

            [TearDown]
            public void TearDown()
            {
                _repository.VerifyAllExpectations();
            }

            [Test]
            public void LoadsStuffFromRepo()
            {
                _repository.Expect(r => r.Load(_id)).Return(_stuff);

                _presenter.Initialize();
            }
        }
    }
}